import babelpolyfill from 'babel-polyfill'
import "./common/js/ployfill"    // 注意文件路径
import Vue from 'vue'
import App from './App'
import glo_loading from "./api/loading"
import {loadingConfig} from "./common/js/loadingConfig";
import {service} from "./api/request";


//==============引入ElementUI=================
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

// 公共前缀ip
Vue.prototype.imageUrl = "http://115.159.217.249:8888"
Vue.prototype.backend = "http://localhost:8085"

import VueRouter from 'vue-router'
import store from './vuex/store'
import Vuex from 'vuex'

// =============路由=============
import routes from './routes'
// =============MockJS=============
/*import Mock from './mock'
Mock.bootstrap();*/

/*// =========设置axios以及后端地址=============
import axios from 'axios'
const service = axios.create({
  baseURL: '/api', // url = base url + request url
  withCredentials: true, // send cookies when cross-domain requests
  timeout: 50000 // request timeout
})
service.interceptors.request.use(
    config => {

    }
)*/
Vue.prototype.$http = service

import 'font-awesome/css/font-awesome.min.css'

Vue.use(ElementUI)
Vue.use(VueRouter)
Vue.use(Vuex)

export const router = new VueRouter({
  routes
})
/*
router.beforeEach((to, from, next) => {
  //NProgress.start();
  if (to.path === '/login') {
    localStorage.removeItem('token');
    localStorage.removeItem('loginUser');
  }
  if(to.path === '/shopRegister'){
    next()
    return
  }
  let user = JSON.parse(localStorage.getItem('loginUser'));
  if (!user && to.path !== '/login') {
    next({ path: '/login' })
  } else {
    next()
  }
})*/

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

